﻿Imports System.Data.OleDb
Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Request.Params("Tagname") = "" Then
            ListView1.DataSourceID = "SqlDataSource1"
        Else
            ListView1.DataSourceID = "SqlDataSource3"
        End If

        Dim sql As String = "SELECT BuildCount, CountOfUserId FROM userbuildcount"

        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("connstr").ConnectionString)
        conn.Open()
        Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)

        Dim odr As OleDbDataReader = cmd.ExecuteReader()
        If odr.HasRows Then
            odr.Read()
            If Not IsDBNull(odr("BuildCount")) Then lbl_builds.Text = odr("BuildCount")
            If Not IsDBNull(odr("CountOfUserId")) Then lbl_users.Text = odr("CountOfUserId")
        End If


       
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_tsearch.Click
        Dim url As String = "Default.aspx?Tagname=" & tb_tsearch.Text
        Response.Redirect(url)
    End Sub
End Class